<template>
  <div class="love-playlist">
    <div class="playlist-header">
      <h3>我收藏的歌单</h3>
      <div class="playlist-count">共 {{ playlists.length }} 个</div>
    </div>
    <div class="playlist-grid">
      <div v-for="playlist in playlists" :key="playlist.id" class="playlist-item">
        <div class="playlist-cover">
          <img :src="playlist.cover" :alt="playlist.name" />
          <div class="playlist-play-count">{{ playlist.playCount }}</div>
        </div>
        <div class="playlist-info">
          <div class="playlist-name">{{ playlist.name }}</div>
          <div class="playlist-creator">by {{ playlist.creator }}</div>
          <div class="playlist-track-count">{{ playlist.trackCount }} 首歌曲</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, type Ref } from 'vue'

interface Playlist {
  id: number
  name: string
  creator: string
  trackCount: number
  playCount: string
  cover: string
}

const playlists: Ref<Playlist[]> = ref([
  { id: 1, name: '我的最爱', creator: '我', trackCount: 25, playCount: '1.2万', cover: '/placeholder-playlist.jpg' },
  { id: 2, name: '流行精选', creator: '音乐达人', trackCount: 50, playCount: '8.5万', cover: '/placeholder-playlist.jpg' },
  { id: 3, name: '深夜电台', creator: '夜猫子', trackCount: 30, playCount: '3.7万', cover: '/placeholder-playlist.jpg' }
])
</script>

<style scoped>
.love-playlist {
  padding: 20px 0;
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #333;
}

.playlist-header h3 {
  color: #ffffff;
  margin: 0;
  font-size: 18px;
}

.playlist-count {
  color: #999;
  font-size: 14px;
}

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.playlist-item {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 15px;
  transition: background-color 0.3s ease;
  cursor: pointer;
}

.playlist-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.playlist-cover {
  width: 100%;
  aspect-ratio: 1;
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.playlist-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: #333;
}

.playlist-play-count {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 12px;
}

.playlist-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.playlist-name {
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
}

.playlist-creator {
  color: #999;
  font-size: 14px;
}

.playlist-track-count {
  color: #666;
  font-size: 12px;
}
</style>